package com.infinitus.nginxInfo.domain;


import java.io.Serializable;
import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;


@Entity
@Table(name = "filter_log")
@NamedQueries({
		@NamedQuery(name = "FilterLog.findAll", query = "SELECT e FROM FilterLog e"),
		@NamedQuery(name = "FilterLog.querySysTopic", query = "SELECT DISTINCT NEW FilterLog(e.ReceiverTopic, e.SystemName) FROM FilterLog e"),
		@NamedQuery(name = "FilterLog.dayCount", query = "SELECT e.ReceiverTopic, SUM(e.FilterCount) FROM FilterLog e WHERE e.ReceiverDate=:receiver_date AND e.ReceiverTopic=:receiver_topic AND  e.ReceiverHour>=:start_hour AND e.ReceiverHour <=:end_hour GROUP BY e.ReceiverTopic"),
		/*@NamedQuery(name = "FilterLog.groupByDay", query = "SELECT NEW FilterLog(e.ReceiverTopic, e.SystemName, e.ReceiverDate, e.EventDate, e.FilterType, SUM(e.FilterCount)) FROM FilterLog e WHERE e.ReceiverDate>=:startDate AND e.ReceiverDate<=:endDate GROUP BY e.ReceiverTopic, e.SystemName, e.ReceiverDate, e.EventDate, e.FilterType ORDER BY e.ReceiverDate"),
		@NamedQuery(name = "FilterLog.groupByHour", query = "SELECT NEW FilterLog(e.ReceiverTopic, e.SystemName, e.ReceiverDate, e.ReceiverHour, e.EventDate, e.FilterType, SUM(e.FilterCount)) FROM FilterLog e WHERE e.ReceiverDate=:date GROUP BY e.ReceiverTopic, e.SystemName, e.ReceiverDate, e.ReceiverHour, e.EventDate, e.FilterType ORDER BY e.ReceiverHour"),*/
		@NamedQuery(name = "FilterLog.findUnique", query = "select e from FilterLog e where e.ReceiverTopic=:ReceiverTopic and e.OsPlat=:OsPlat and e.ReceiverDate=:ReceiverDate and e.ReceiverHour=:ReceiverHour and e.EventDate=:EventDate  and e.SystemName=:SystemName and e.FilterType=:FilterType")})
public class FilterLog implements Serializable {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = -2778065596374902044L;

	public FilterLog(String receiverTopic, String osPlat,
			String receiverDate, Integer receiverHour,
			String eventDate, String systemName,
			String filterType, Integer filterCount, Date addTime) {
		super();
		ReceiverTopic = receiverTopic;
		OsPlat = osPlat;
		ReceiverDate = receiverDate;
		ReceiverHour = receiverHour;
		EventDate = eventDate;
		SystemName = systemName;
		FilterType = filterType;
		FilterCount = filterCount;
		AddTime = addTime;
	}



	public FilterLog(String receiverTopic, String systemName) {
		super();
		ReceiverTopic = receiverTopic;
		SystemName = systemName;
	}


	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private long id;
	
	private String ReceiverTopic;
	
	private String OsPlat;
	
	private String SystemName;

	private String ReceiverDate;

	private Integer ReceiverHour;

	private String EventDate;
	
	private String FilterType;
	
	private Integer FilterCount;
	
	
	@Temporal(TemporalType.TIMESTAMP)
	private Date AddTime;
	
	
	public FilterLog() {
		super();
	}


	public Integer getReceiverHour() {
		return ReceiverHour;
	}



	public void setReceiverHour(Integer receiverHour) {
		ReceiverHour = receiverHour;
	}



	public Integer getFilterCount() {
		return FilterCount;
	}



	public void setFilterCount(Integer filterCount) {
		FilterCount = filterCount;
	}



	public String getReceiverTopic() {
		return ReceiverTopic;
	}



	public void setReceiverTopic(String receiverTopic) {
		ReceiverTopic = receiverTopic;
	}



	public long getId() {
		return id;
	}


	public void setId(long id) {
		this.id = id;
	}



	public String getSystemName() {
		return SystemName;
	}



	public void setSystemName(String systemName) {
		SystemName = systemName;
	}



	public String getEventDate() {
		return EventDate;
	}



	public void setEventDate(String eventDate) {
		EventDate = eventDate;
	}



	public String getOsPlat() {
		return OsPlat;
	}



	public void setOsPlat(String osPlat) {
		OsPlat = osPlat;
	}



	public String getReceiverDate() {
		return ReceiverDate;
	}



	public void setReceiverDate(String receiverDate) {
		ReceiverDate = receiverDate;
	}



	public String getFilterType() {
		return FilterType;
	}



	public void setFilterType(String filterType) {
		FilterType = filterType;
	}


	public Date getAddTime() {
		return AddTime;
	}



	public void setAddTime(Date addTime) {
		AddTime = addTime;
	}



	@Override
	public String toString() {
		return "FilterLog [id=" + id + ", ReceiverTopic=" + ReceiverTopic
				+ ", OsPlat=" + OsPlat + ", SystemName=" + SystemName
				+ ", ReceiverDate=" + ReceiverDate + ", ReceiverHour="
				+ ReceiverHour + ", EventDate=" + EventDate + ", FilterType="
				+ FilterType + ", FilterCount=" + FilterCount + ", AddTime="
				+ AddTime + "]";
	}


	
}
